<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<title>后台</title>
	<meta name="keywords" content="" />
	<meta name="description" content="" />
	<meta name="baidu-site-verification" content="unXl91MyB6" />
	<link rel="stylesheet" type="text/css" href="/Data/static/bootstrap/3.3.5/css/bootstrap.min.css" media="screen">	
	<link rel='stylesheet' type="text/css" href="/App/Manage/View/Public/css/main.css" />
	<!-- 头部css文件|自定义  -->
	

	<script type="text/javascript" src="/Data/static/js/jquery-1.11.3.min.js"></script>
	<script type="text/javascript" src="/Data/static/bootstrap/3.3.5/js/bootstrap.min.js"></script>

	<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
		<script src="/Data/static/js/html5shiv.min.js"></script>
		<script src="/Data/static/js/respond.min.js"></script>
    <![endif]-->
	
	<script type="text/javascript" src="/App/Manage/View/Public/js/jquery.form.min.js"></script>
	<script type="text/javascript" src="/Data/static/jq_plugins/layer/layer.js"></script>
	<script language="JavaScript">
	    <!--
	    var URL = '/admin.php?s=/Map';
	    var APP	 = '/admin.php?s=';
	    var SELF='/admin.php?s=/Map/edit/id/10';
	    var PUBLIC='/App/Manage/View/Public';
	    var data_path = "/Data";
		var tpl_public = "/App/Manage/View/Public";
	    //-->
	</script>
	<script type="text/javascript" src="/App/Manage/View/Public/js/common.js"></script> 
	<!-- 头部js文件|自定义 -->
	
</head>
<body>
	<div class="xyh-content">
		
    <div class="row">
        <div class="col-lg-12">
            <h3 class="page-header"><em class="glyphicon glyphicon-cloud-upload"></em>
                添加地图
            </h3>
        </div>
    </div>

    <div class="row">
        <div class="col-lg-12">

            <form method='post' class="form-horizontal" id="form_do" name="form_do">
                <div class="form-group">
                    <label  class="col-sm-2 control-label">公司名称</label>
                    <div class="col-sm-9">
                        <input type="text" value="<?php echo ($data[title]); ?>" name="title" id="inputName" class="form-control" placeholder="公司名" required="required" />
                    </div>
                </div>

                <div class="form-group">
                    <label  class="col-sm-2 control-label">显示宽度</label>
                    <div class="col-sm-9">
                        <input type="text" value="<?php echo ($data[width]); ?>" name="width" id="inputModule" class="form-control" placeholder="前端地图宽度" />
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">显示高度</label>
                    <div class="col-sm-9">
                        <input type="text" value="<?php echo ($data[height]); ?>" name="height" id="inputAction" class="form-control" placeholder="前端地图高度" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">电话号码</label>
                    <div class="col-sm-9">
                        <input type="text" value="<?php echo ($data[phone]); ?>" name="phone" class="form-control" placeholder="电话号码" />
                    </div>
                </div>

                <div class="form-group">
                    <label  class="col-sm-2 control-label">内容</label>
                    <div class="col-sm-9">
                        <textarea name="content" style="width: 40%;height: 100px"><?php echo ($data[content]); ?></textarea>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">地址</label>
                    <div class="col-sm-9">
                        <input type="text" value="<?php echo ($data[address]); ?>" name="address" class="form-control" placeholder="地址详情" />
                    </div>
                </div>

                <div style="width: 50%;float: left;padding-left: 10%">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">经度</label>
                        <div class="col-sm-9">
                            <input type="text" value="<?php echo ($data[lng]); ?>" style="width: 80%" name="lng" id="lng" class="form-control" placeholder="世界经度" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">纬度</label>
                        <div class="col-sm-9">
                            <input type="text" value="<?php echo ($data[lat]); ?>" style="width: 80%" name="lat" id="lat" class="form-control" placeholder="世界纬度" />
                        </div>
                    </div>
                </div>
                <div style="width: 50%;float: left;padding-left: 2%">
                    <button id="getPlace" type="button" style="width: 100px;height: 40px">获取经纬度</button>
                </div>
                <div class="row margin-botton-large">
                    <div class="col-sm-offset-2 col-sm-9">
                        <div class="btn-group">
                            <button type="submit" class="btn btn-primary"> <i class="glyphicon glyphicon-saved"></i>
                                保存
                            </button>
                            <button type="button" onclick="goUrl('<?php echo U('index');?>')" class="btn btn-default"> <i class="glyphicon glyphicon-chevron-left"></i>
                                返回
                            </button>
                        </div>
                    </div>
                </div>
            </form>
            <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=529eb7ba903532ee5927ad36f7eb149f"></script>
            <script type="text/javascript" src="http://api.map.baidu.com/library/SearchInfoWindow/1.5/src/SearchInfoWindow_min.js"></script>
            <link rel="stylesheet" href="http://api.map.baidu.com/library/SearchInfoWindow/1.5/src/SearchInfoWindow_min.css" />
            <script type="text/javascript">
                $(function(){
                    var x=0,y=0;
                    var marker;
                    var map = new BMap.Map('map');
                    map.enableScrollWheelZoom();
                    map.addEventListener('click',function(e){
                        map.centerAndZoom(e.point, 16);
                        map.clearOverlays();
                        map.addOverlay(new BMap.Marker(e.point));
                        x = map.getCenter().lng;
                        y = map.getCenter().lat;
                        $("#lb_longlat").text('坐标'+x+','+y);
                      //  prompt("鼠标单击地方的经纬度为：",e.point.lng + "," + e.point.lat);
                    });
                    $('#getPlace').click(function(){
                        var myGeo = new BMap.Geocoder();
                        // 将地址解析结果显示在地图上,并调整地图视野
                        myGeo.getPoint("中国", function(point){
                            if (point) {
                                map.centerAndZoom(point, 5);
                                map.clearOverlays();
                                marker = new BMap.Marker(point);
                                map.addOverlay(marker);
                                x = map.getCenter().lng;
                                y = map.getCenter().lat;
                                $("#lb_longlat").text('坐标'+x+','+y);
                            }
                        }, "中国");

                        $("#map_box").show();
                    });
                    $('#close_btn').click(function(){
                        $("#map_box").hide();
                    });
                    $("#useBtn").click(function(){ //使用此坐标
                        $("#lng").val(x);
                        $("#lat").val(y);
                        $("#map_box").hide();
                    });

                    $("#search_btn").click(function(){ //搜索地图
                        var txt = $("#search_txt").val();
                        var myGeo = new BMap.Geocoder();
                        myGeo.getPoint(txt, function(point){
                            if (point) {
                                map.centerAndZoom(point, 15);
                                map.clearOverlays();
                                map.addOverlay(new BMap.Marker(point));

                                x = map.getCenter().lng;
                                y = map.getCenter().lat;

                                $("#lb_longlat").text('坐标'+x+','+y);
                            }
                        }, "中国");

                    });
                });
            </script>
            <div id="map_box" class="map clear" style="position:fixed;left:100px;top:100px;width:900px;;height:450px;;background:#F1F6F9;border:1px solid #000;display:none;">
                <div style="margin:5px auto;position:relative;">
                    <span style="line-height: 19px;font: bold 12px arial, sans-serif;margin-left:50px;">搜索：</span><input id="search_txt" type="text" value="中国" />
                    <input style="margin-left:5px;" id="search_btn" type="button" value="查找经纬度" class="button" />
    	            <span id="search_result">
                    <span id="lb_longlat"></span><input style="margin-left:5px;" id="useBtn" type="button" value="使用此坐标" class="button" /></span>
                    <input style="position:absolute;right:50px;" id="close_btn" type="button" value="关闭" class="button" />
                </div>
                <div id="map" style="width:800px;height:400px;display:block;margin:0 auto;border:1px #fff solid;">
                </div>
            </div>

        </div>
    </div>

			
	</div>	
</body>
</html>